<{include file="dcenter/block/header.html"}>
<style type="text/css">
    .bt-big {
        min-width: 100px;
        height: 26px;
        line-height: 26px;
        padding: 0 7px;
        text-align: center;
        color: #333333;
        background: url(/admin/images/bt-big-bak.gif) repeat-x;
        border: 1px solid #86A1C0;
        font-weight: bolder;
        cursor: pointer;
        letter-spacing: 5px;
        margin: 3px 10px;
        font-family: "microsoft yahei","Tahoma","simsun","Verdana","Arial","Helvetica";
    }
    #pickfiles{
        display: block;width: 80px;height: 24px;background-color: #fff8ed;border: 1px solid #fdd796;text-align: center;color: #D95F23;text-decoration: none;
    }
</style>
<div class="ucenter_t">
    <ul><li class="on">工地日记</li></ul>
</div>

<div class="tip-notice">
    <div class="SWF_Widget">
        <a id="pickfiles"> 点击上传 </a>
    </div>
</div>

<div class="ucenter_c">
    <form id="items-form">
        <table width="100%" border="0" cellspacing="0" class="table">
            <tr>
                <th class="w-100">ID</th>
                <th class="w-100">图片</th>
                <th class="">标题</th>
                <th class="">排序</th>
                <th class="">大小</th>
                <th class="">上传时间</th>
                <th class="">操作</th>
            </tr>
            <{foreach $photos as $item}>
                <tr>
                    <td><label><input type="checkbox" value="<{$item.photo_id}>" name="photo_id[]" CK="PRI"/><{$item.photo_id}></label></td>
                    <td><img src="<{$pager.img}>/<{$item.photo}>_small.jpg" class="wh-50" photo="<{$pager.img}>/<{$item.photo}>_thumb.jpg" /></td>
                    <td><input type="text" name="data[<{$item.photo_id}>][title]" value="<{$item.title}>" class="input w-300"/></td>
                    <td><input type="text" name="data[<{$item.photo_id}>][orderby]" value="<{$item.orderby}>" class="input w-50"/></td>
                    <td><{$item.size|format:"size"}></td>
                    <td class="w-150"><{$item.dateline|format:'Y-m-d H:m:s'}></td>
                    <td>
                        <a href="<{link ctl='dcenter/gz/diary:diary_image_delete' arg0=$item.photo_id arg1=$item.item_id}>" mini-act="删除" mini-confirm="确定要删除吗？" class="pbtn red">删除</a>
                    </td>
                </tr>
            <{foreachelse}>
                <tr><td colspan="20"><p class="tips"><span class="notice">没有数据</span></p></td></tr>
            <{/foreach}>
        </table>
    </form>
    <div class="page-bar">
        <table>
            <tr>
                <td class="w-100"><label><input type="checkbox" CKA="PRI"/>&nbsp;&nbsp;全选</label></td>
                <td colspan="10" class="left">
                    <!--<a href="<{link ctl='dcenter/gz/diary:diary_image_delete'}>" mini-act="删除" mini-confirm="确定要删除选中的内容吗？" class="pbtn bt-big">批量删除</a>-->
                    <button action="<{link ctl='dcenter/gz/diary:diary_image_delete'}>" type="button" mini-submit="#items-form" mini-confirm="确定要删除选中的内容吗?" priv="hide" value="批量删除" class="bt-big">批量删除</button>
                    <button action="<{link ctl='dcenter/gz/diary:diary_image_update'}>" type="button" mini-submit="#items-form" priv="hide" value="批量更新" class="bt-big">批量更新</button>
                </td>
                <td class="page-list"><{$pager.pagebar}></td>
            </tr>
        </table>
    </div>
</div>

<script src="<{$pager.res}>/plupload/plupload.full.min.js" type="text/javascript"></script>
<script type="text/javascript" language="JavaScript">
    $(function () {
        var uploader = new plupload.Uploader({
            runtimes: 'html5,flash,silverlight,html4',
            browse_button: 'pickfiles',
            url: "/dcenter/gz/diary/diary_image_upload.html",
            filters: {
                max_file_size: '5mb',
                mime_types: [
                    {title: "Image files", extensions: "jpg,gif,png"}
                ]
            },
            multi_selection: false,
            file_data_name: 'file',
            multipart_params: {
                '_token': '41544F4B454EO32372D4B543230423138374443334339424337323041364334463930383035443842393846I4147454E54O4D6F7A696C6C612F352E30202857696E646F7773204E5420362E3129204170706C655765624B69742F3533372E333620284B48544D4C2C206C696B65204765636B6F29204368726F6D652F35312E302E323730342E313033205361666172692F3533372E3336',
                'item_id' : '<{$item_id}>',
                'site_id' : "<{$detail['site_id']}>",
                'status'  : "<{$site['status']}>"
            },
            // Flash settings
            flash_swf_url: '<{$pager.res}>/plupload/Moxie.swf',
            // Silverlight settings
            silverlight_xap_url: '<{$pager.res}>/plupload/Moxie.xap',
            init: {
                PostInit: function () {
                    return false;
                },
                FilesAdded: function (up, file) {
                    uploader.start();
                },
                Error: function (up, err) {
                    tips(err.message);
                },
                FileUploaded: function (up, file, responseObj) {
                    window.location.reload();
                }
            }
        });
        uploader.init();

        (function(T, $){
            $(":checkbox[CKA]").die("click").live("click",function(){
                var $cks = $(":checkbox[CK='"+$(this).attr("CKA")+"']");;
                if($(this).attr("checked")){
                    $cks.each(function(){$(this).attr("checked",true);});
                }else{
                    $cks.each(function(){$(this).attr("checked",false);});
                }
            });
        })(window.KT, window.jQuery);
    });
</script>

<{include file="dcenter/block/footer.html"}>